function GetQueryString(e) {
  e = new RegExp("(^|&)" + e + "=([^&]*)(&|$)"), e = window.location.search.substr(1).match(e);
  return null != e ? unescape(e[2]) : null
}

function escapeHTML(e) {
  return e ? (e = (e = (e = (e = e.replace(/&/g, "&amp;")).replace(/</g, "&lt;")).replace(/>/g, "&gt;")).replace(/"/g, "&quot;")).replace(/'/g, "&#39;") : ""
}
var Chaoshi = {
  cityId: GetQueryString("ct"),
  searchParam: {
    breedNames: "",
    breedIds: "",
    prBreedId: "total" == $(".tab-slider li.cur").attr("data-id") ? "" : $(".tab-slider li.cur").attr("data-id"),
    specs: "",
    materials: "",
    brands: "",
    warehouses: "",
    cityId: GetQueryString("ct"),
    cityName: "",
    startThickness: "",
    endThickness: "",
    startWidth: "",
    endWidth: "",
    startLength: "",
    endLength: "",
    endPrice: "",
    pageSize: "28",
    pageNum: "1",
    breedSort: "",
    specSort: "",
    materialSort: "",
    brandSort: "",
    citySort: "",
    warehouseSort: "",
    averageQtySort: "",
    priceSort: "",
    keyword: ""
  },
  $keyword: $("#keyword"),
  $category: $("#category"),
  $spec: $("#spec"),
  $material: $("input#material"),
  $factory: $("#factory"),
  $stock: $("#stock"),
  keyRes: $(".sear-res").html(),
  urlObj: {
    categoryUrl: "https://chaoshi.banksteel.com//chaoshi/queryCategory.jsp",
    specUrl: "https://chaoshi.banksteel.com//chaoshi/querySpec.jsp",
    materialUrl: "https://chaoshi.banksteel.com//chaoshi/queryMaterial.jsp",
    factoryUrl: "https://chaoshi.banksteel.com//chaoshi/queryFactory.jsp",
    warehouseUrl: "https://chaoshi.banksteel.com//chaoshi/queryWarehouse.jsp",
    breedChangeUrl: "https://chaoshi.banksteel.com//chaoshi/getQueryProperty.jsp",
    pageItemUrl: "https://chaoshi.banksteel.com//chaoshi/queryPageItem.jsp",
    ItemBySummaryUrl: "https://chaoshi.banksteel.com//chaoshi/queryItemBySummaryCode.jsp",
    warehouseInforUrl: "https://chaoshi.banksteel.com//chaoshi/findWarehouseByCode.jsp"
  },
  setCookie: function (e, a, t) {
    $.cookie(e, a)
  },
  getCookie: function (e) {
    return $.cookie(e) || ""
  },
  itemSunmary: function (o, e) {
    $.ajax({
      url: Chaoshi.urlObj.ItemBySummaryUrl,
      type: "post",
      data: {
        summaryCode: e
      },
      dataType: "json",
      success: function (e) {
        if (e) {
          for (var a = e.recordList, t = "", i = "", s = 0; s < a.length; s++) {
            i = e.isWorkTime && a[s].isOutDate ? "-" : a[s].price, t += '<tr class="item-data-detail"><td><div class="pad-l14 t-l blue" title="' + a[s].categoryName + '"><a href="javascript:void(0);">' + a[s].categoryName + '</a><div class="pop-bname"><div class="pop-bname-arrow"></div><div class="pop-bname-col">别名：' + a[s].categoryAlias + "<br>备注：" + a[s].remark + "</div></div></div></td><td>" + a[s].specName + "</td><td>" + a[s].materialName + "</td><td>" + a[s].factoryName + "</td><td>" + a[s].areaName + '</td><td><div class="warehouse-name"><a class="t-warehouse" href="javascript:void(0);" data-code="' + a[s].warehouseCode + '">' + a[s].warehouseName + '</a><div class="pop-warehouse"></div><div class="pop-warehouse-arrow"></div></div></td><td><div class="pad-l7">' + a[s].num + "</div></td><td>" + a[s].averageQty + a[s].numUnit + '</td><td title="' + a[s].weightWayName + '">' + a[s].qty + a[s].numUnit + '</td><td class="price">' + i + '</td><td><div class="cl">', e.isWorkTime ? a[s].isOutDate ? t += '<div class="operate"><a class="btn-buy-gray" href="javascript:void(0);">待挂牌</a></div>' : t += '<div class="operate"><a onclick="addCart(' + a[s].id + "," + a[s].num + "," + a[s].price + "," + a[s].qty + "," + a[s].averageQty + ',1,this);" href="javascript:void(0);" class="buy btnCart">购买</a></div>' : t += '<div class="operate"><a class="btn-buy-gray" href="javascript:void(0);">已闭市</a></div>';
            var r = "";
            a[s].adminQQ && (r = '<a class="link" href="http://b.qq.com/webc.htm?new=0&sid=' + a[s].adminQQ + '&eid=218808P8z8p8y8Q8P8y8K&o=banksteel.com&q=7&ref=http://www.banksteel.com/" target="_blank"><span>' + a[s].adminQQ + "</span></a>"), t += '<div class="chat f-fl"><a class="img" href="javascript:void(0);"></a><div class="pop-tel"> <b class="pop-user">' + a[s].adminName + " </b>" + r + (a[s].adminPhone ? "<div>电话：" + a[s].adminPhone + "</div>" : "") + "<div>手机：" + a[s].adminMobile + '</div></div><div class="pop-tel-arrow"></div></div></div></td></tr>'
          }
          t += '<tr class="item-data-detail"><td colspan="11"><span class="btn-blue-back140">点击折叠资源</span></td></tr>'
        }
        $(".item-data").removeClass("show"), $(".btn-open").addClass("btnoff"), $(".btn-open").text("展开"), $(".table_hover div").css("display", "none"), $(".item-data-detail").remove(), $(".btn-open").addClass("btnoff"), o.find(".btn-open").removeClass("btnoff"), o.find(".btn-open").text("收起"), o.parent(".item-data").addClass("show"), o.parent().append(t), setTimeout(function () {
          o.find(".table_hover div").css("display", "block");
          var e = o.parent(".item-data").height() - 37,
            a = o.parent(".item-data").height();
          o.find(".table_hover .table_hover_bottom").css("top", e + "px"), o.find(".table_hover .table_hover_left").css("height", a + "px"), o.find(".table_hover .table_hover_right").css("height", a + "px")
        }, 10)
      }
    })
  },
  searchList: function (h, e) {
    if (!e) {
      for (var a = $(".icon-sort"), t = 0; t < a.length; t++) "table_sortPrice" != a.eq(t).attr("id") && a.eq(t).children("i").attr("class", "basic");
      Chaoshi.searchParam.breedSort = "", Chaoshi.searchParam.specSort = "", Chaoshi.searchParam.materialSort = "", Chaoshi.searchParam.brandSort = "", Chaoshi.searchParam.citySort = "", Chaoshi.searchParam.warehouseSort = "", Chaoshi.searchParam.averageQtySort = ""
    }
    $("#table tbody").remove(), $("#table").append('<tbody><tr class="item-loading"><td align="center" colspan="11"><img width="160" height="120" src="images/loading.gif"></td></tr></tbody>'), $("#table").find(".item-loading img").animate({
      left: "520px"
    }, 1e3), h || (h = 1, $("#page_num").text("1")), Chaoshi.searchParam.pageNum = h, Chaoshi.searchParam.cityId = Chaoshi.cityId, 0 < $("#filter_keyword").length && (Chaoshi.searchParam.keyword = $("#filter_keyword .filter-name").text()), 0 < $("#filter_city").length && (Chaoshi.searchParam.cityId = $("#filter_city .filter-name").attr("data-id"), Chaoshi.searchParam.cityName = $("#filter_city .filter-name").text()), Chaoshi.searchParam.token = Chaoshi.getCookie("user_token"), $.ajax({
      url: Chaoshi.urlObj.pageItemUrl,
      type: "post",
      data: Chaoshi.searchParam,
      dataType: "json",
      success: function (e) {
        var a, t = "";
        if (e) {
          if (!e.recordList) return a = '<tbody><tr class="hasno"><td align="center" colspan="11"><div class="goods_tips cl"><div class="fl goods_tips_img"></div><div class="goods_tips_inner fl"><div class="conten3 cl"><span>' + e.message + "</span></div></div></div></td></tr></tbody>", setTimeout(function () {
            $("#table tbody").remove(), $("#table").append(a), $(".mtable tr:even").addClass("alt")
          }, 800), !1;
          Chaoshi.searchChange(e.searchItems), $(".total-count").text(e.totalCount), $("#page_count").text(200 < Math.ceil(e.totalCount / 28) ? 200 : Math.ceil(e.totalCount / 28)), $("#bankSteelpager").bankSteelPager({
            pagenumber: h,
            pagecount: 200 < Math.ceil(e.totalCount / 28) ? 200 : Math.ceil(e.totalCount / 28),
            buttonClickCallback: Chaoshi.PageClick
          });
          var i = e.recordList;
          if (0 < i.length) {
            $("#bankSteelpager").show();
            for (var s, r = 0; r < i.length; r++) i[r].isSummary ? (s = "", s = e.isWorkTime && i[r].isOutDate ? "-" : i[r].price, t += '<tbody class="item-data"><tr class="item-data-m" data-id="' + i[r].summaryCode + '"><td><div class="pad-l14 t-l blue" title="' + i[r].categoryName + '"><a href="javascript:void(0);">' + i[r].categoryName + '</a><div class="pop-bname"><div class="pop-bname-arrow"></div><div class="pop-bname-col">别名：' + i[r].categoryAlias + "<br>备注：" + i[r].remark + "</div></div></div></td><td>" + i[r].specName + "</td><td>" + i[r].materialName + "</td><td>" + i[r].factoryName + "</td><td>" + i[r].areaName + '</td><td><div class="warehouse-name"><a class="t-warehouse" href="javascript:void(0);" data-code="' + i[r].warehouseCode + '">' + i[r].warehouseName + '</a><div class="pop-warehouse"></div><div class="pop-warehouse-arrow"></div></div></td><td><div class="pad-l7">' + i[r].num + '</div></td><td>-</td><td title="' + (i[r].weightWayName || "") + '">' + i[r].qty + i[r].numUnit + '</td><td class="price">' + s + '</td><td><div class="cl"><div class="operate"> <a class="btn-open btnoff" href="javascript:void(0);">展开</a><div class="table_hover"><div  class="table_hover_left"></div><div class="table_hover_right"></div><div  class="table_hover_top"></div><div  class="table_hover_bottom" ></div></div></div></div></td></tr></tbody>') : (t += '<tbody><tr><td><div class="pad-l14 t-l blue" title="' + i[r].categoryName + '"><a href="javascript:void(0);">' + i[r].categoryName + '</a><div class="pop-bname"><div class="pop-bname-arrow"></div><div class="pop-bname-col">别名：' + i[r].categoryAlias + "<br>备注：" + i[r].remark + "</div></div></div></td><td>" + i[r].specName + "</td><td>" + i[r].materialName + "</td><td>" + i[r].factoryName + "</td><td>" + i[r].areaName + '</td><td><div class="warehouse-name"><a class="t-warehouse" href="javascript:void(0);" data-code="' + i[r].warehouseCode + '">' + i[r].warehouseName + '</a><div class="pop-warehouse"></div><div class="pop-warehouse-arrow"></div></div></td><td><div class="pad-l7">' + i[r].num + "</div></td><td>" + i[r].averageQty + i[r].numUnit + '</td><td title="' + i[r].weightWayName + '">' + i[r].qty + i[r].numUnit + "</td>", e.isWorkTime ? i[r].isOutDate ? t += '<td class="price">-</td><td><div class="cl"><div class="operate"><a class="btn-buy-gray" href="javascript:void(0);">待挂牌</a></div>' : t += '<td class="price">' + i[r].price + '</td><td><div class="cl"><div class="operate"><a onclick="addCart(' + i[r].id + "," + i[r].num + "," + i[r].price + "," + i[r].qty + "," + i[r].averageQty + ',1,this);" href="javascript:void(0);" class="buy btnCart">购买</a></div>' : t += '<td class="price">' + i[r].price + '</td><td><div class="cl"><div class="operate"><a class="btn-buy-gray" href="javascript:void(0);">已闭市</a></div>', s = "", i[r].adminQQ && (s = '<a class="link" href="http://b.qq.com/webc.htm?new=0&sid=' + i[r].adminQQ + '&eid=218808P8z8p8y8Q8P8y8K&o=banksteel.com&q=7&ref=http://www.banksteel.com/" target="_blank"><span>' + i[r].adminQQ + "</span></a>"), t += '<div class="chat f-fl"><a class="img" href="javascript:void(0);"></a><div class="pop-tel"> <b class="pop-user">' + i[r].adminName + " </b>" + s + (i[r].adminPhone ? "<div>电话：" + i[r].adminPhone + "</div>" : "") + "<div>手机：" + i[r].adminMobile + '</div></div><div class="pop-tel-arrow"></div></div></div></td></tr></tbody>')
          } else {
            $("#bankSteelpager").hide();
            for (var o = $("#search_filter").find(".filter"), r = 0; r < o.length; r++) "filter_thickness" == o.eq(r).attr("id") ? o.eq(r).children(".filter-name").text() : "filter_width" == o.eq(r).attr("id") ? o.eq(r).children(".filter-name").text() : "filter_price" == o.eq(r).attr("id") ? o.eq(r).children(".filter-name").text() : "filter_length" == o.eq(r).attr("id") ? o.eq(r).children(".filter-name").text() : o.eq(r).children(".filter-name").text();
            $(".tab-slider li.cur").attr("data-name");
            t = '<tbody><tr class="hasno"><td align="center" colspan="11"><div class="no-search"><div class="i-dog"></div><div class="text">没找到想要的资源？快试试“快速求购”</div><div class="btn-box"><a href="javascript:;" class="btn btn-ksqg">快速求购</a></div><div class="icons"></div></div></td></tr></tbody>'
          }
          setTimeout(function () {
            $("#table tbody").remove(), $("#table").append(t), $(".mtable tr:even").addClass("alt")
          }, 800)
        }
      }
    })
  },
  priceSearch: function () {
    pr1 = $("#pr1").val(), pr2 = $("#pr2").val(), "￥最低价" == pr1 && (pr1 = ""), "￥最高价" == pr2 && (pr2 = ""), Chaoshi.searchSinglePrice(pr1, pr2)
  },
  priceClear: function () {
    Chaoshi.searchSinglePrice("", ""), Chaoshi.searchList()
  },
  theadSort: function (e, a) {
    var a = $(a).children("i"),
      t = a.attr("class");
    "basic" == t ? (a.removeClass("basic"), a.addClass("up")) : "up" == t ? (a.removeClass("up"), a.addClass("down")) : "down" == t && (a.removeClass("down"), a.addClass("basic")), "breedSort" == e ? "basic" == t ? Chaoshi.searchParam.breedSort = "1" : "up" == t ? Chaoshi.searchParam.breedSort = "2" : "down" == t && (Chaoshi.searchParam.breedSort = "") : "specSort" == e ? "basic" == t ? Chaoshi.searchParam.specSort = "1" : "up" == t ? Chaoshi.searchParam.specSort = "2" : "down" == t && (Chaoshi.searchParam.specSort = "") : "materialSort" == e ? "basic" == t ? Chaoshi.searchParam.materialSort = "1" : "up" == t ? Chaoshi.searchParam.materialSort = "2" : "down" == t && (Chaoshi.searchParam.materialSort = "") : "brandSort" == e ? "basic" == t ? Chaoshi.searchParam.brandSort = "1" : "up" == t ? Chaoshi.searchParam.brandSort = "2" : "down" == t && (Chaoshi.searchParam.brandSort = "") : "citySort" == e ? "basic" == t ? Chaoshi.searchParam.citySort = "1" : "up" == t ? Chaoshi.searchParam.citySort = "2" : "down" == t && (Chaoshi.searchParam.citySort = "") : "warehouseSort" == e ? "basic" == t ? Chaoshi.searchParam.warehouseSort = "1" : "up" == t ? Chaoshi.searchParam.warehouseSort = "2" : "down" == t && (Chaoshi.searchParam.warehouseSort = "") : "averageQtySort" == e ? "basic" == t ? Chaoshi.searchParam.averageQtySort = "1" : "up" == t ? Chaoshi.searchParam.averageQtySort = "2" : "down" == t && (Chaoshi.searchParam.averageQtySort = "") : "priceSort" == e && ("basic" == t ? (Chaoshi.searchParam.priceSort = "1", $("#sortPrice").attr("class", "sorton")) : "up" == t ? (Chaoshi.searchParam.priceSort = "2", $("#sortPrice").attr("class", "sortoff")) : "down" == t && (Chaoshi.searchParam.priceSort = "", $("#sortPrice").attr("class", "default"))), Chaoshi.searchList($("#page_num").text(), !0)
  },
  sortPrice: function (e) {
    e = ($ele = $(e)).attr("class");
    "default" == e ? ($ele.removeClass("default"), $ele.addClass("sorton"), Chaoshi.searchParam.priceSort = "1", $("#table_sortPrice i").attr("class", "up")) : "sorton" == e ? ($ele.removeClass("sorton"), $ele.addClass("sortoff"), Chaoshi.searchParam.priceSort = "2", $("#table_sortPrice i").attr("class", "down")) : "sortoff" == e && ($ele.removeClass("sortoff"), $ele.addClass("default"), Chaoshi.searchParam.priceSort = "", $("#table_sortPrice i").attr("class", "basic")), Chaoshi.searchList()
  },
  sortDefault: function () {
    $("#sortPrice").attr("class", "default"), $("#table_sortPrice i").attr("class", "basic"), Chaoshi.searchParam.priceSort = "", Chaoshi.searchList()
  },
  searchAll: function () {
    Chaoshi.searchSingleThickness($(".input-thickness .inp2").val(), $(".input-thickness .inp3").val()), Chaoshi.searchSingleWidth($(".input-width .inp2").val(), $(".input-width .inp3").val()), Chaoshi.searchSingleLength($(".input-length .inp2").val(), $(".input-length .inp3").val()), Chaoshi.$category.val() ? Chaoshi.filterAdd("filter_breed", [{
      id: Chaoshi.$category.val(),
      text: Chaoshi.$category.val()
    }]) : 0 == $("#breed_html").find("a.cur").length && Chaoshi.filterClear($("#filter_breed"), !1), Chaoshi.$material.val() ? Chaoshi.filterAdd("filter_material", [{
      id: Chaoshi.$material.val(),
      text: Chaoshi.$material.val()
    }]) : 0 == $("#material_html").find("a.cur").length && Chaoshi.filterClear($("#filter_material"), !1), Chaoshi.$factory.val() ? Chaoshi.filterAdd("filter_factory", [{
      id: Chaoshi.$factory.val(),
      text: Chaoshi.$factory.val()
    }]) : 0 == $("#factory_content").find("div.selected").length && Chaoshi.filterClear($("#filter_factory"), !1), Chaoshi.$stock.val() ? Chaoshi.filterAdd("filter_stock", [{
      id: Chaoshi.$stock.val(),
      text: Chaoshi.$stock.val()
    }]) : 0 == $("#warehouses_html").find("a.cur").length && Chaoshi.filterClear($("#filter_stock"), !1), Chaoshi.$spec.val() ? Chaoshi.filterAdd("filter_spec", [{
      id: Chaoshi.$spec.val(),
      text: Chaoshi.$spec.val()
    }]) : Chaoshi.filterClear($("#filter_spec"), !1), Chaoshi.searchParam.breedIds = "", Chaoshi.searchParam.breedNames = Chaoshi.filterGet("breed"), Chaoshi.searchParam.specs = Chaoshi.filterGet("spec"), Chaoshi.searchParam.materials = Chaoshi.filterGet("material"), Chaoshi.searchParam.brands = Chaoshi.filterGet("factory"), Chaoshi.searchParam.whText = Chaoshi.filterGet("stock"), Chaoshi.querySearch(Chaoshi.urlObj.categoryUrl, Chaoshi.$category, Chaoshi.filterGet("breed"), "searchSingleBreed"), Chaoshi.querySearch(Chaoshi.urlObj.specUrl, Chaoshi.$spec, Chaoshi.filterGet("spec"), "searchSingleSpec"), Chaoshi.querySearch(Chaoshi.urlObj.materialUrl, Chaoshi.$material, Chaoshi.filterGet("material"), "searchSingleMaterial"), Chaoshi.querySearch(Chaoshi.urlObj.factoryUrl, Chaoshi.$factory, Chaoshi.filterGet("factory"), "searchSingleFactory"), Chaoshi.querySearch(Chaoshi.urlObj.warehouseUrl, Chaoshi.$stock, Chaoshi.filterGet("stock"), "searchSingleWarehouses"), Chaoshi.searchList()
  },
  inputEnter: function () {
    "13" == event.keyCode && Chaoshi.searchAll()
  },
  filterClear: function (e, a) {
    if (e.remove(), 0 == $(".filter").length && $(".search-filter-more").hide(), "filter_city" == e.attr("id") && (Chaoshi.cityId = ""), "filter_thickness" != e.attr("id") && "filter_width" != e.attr("id") || Chaoshi.searchList(), !a) {
      for (var t = Chaoshi.getCookie("csHistorySearch") + "/", i = $("#search_filter").find(".filter"), s = 0; s < i.length; s++) {
        var r = i.eq(s).children(".filter-name").text().replace(/\,/g, "+");
        t += "{" + i.eq(s).attr("id").split("_")[1] + "_" + r + "}"
      }
      Chaoshi.setCookie("csHistorySearch", t), Chaoshi.historySearchFun()
    }
  },
  filterClearAll: function () {
    var e = Chaoshi.getCookie("csHistorySearch") + "/";
    Chaoshi.setCookie("csHistorySearch", e), Chaoshi.historySearchFun();
    e = (e = location.href).split("?");
    window.location.href = e[0]
  },
  historySearchFun: function () {
    var e = getCookie("csHistorySearch"),
      a = [],
      t = (e = decodeURIComponent(e)) ? e.split("/") : [];
    for (n in e = [], t)
      for (var i = 0; i < t.length; i++) t[n] == t[i] && n == i && "" != t[n] && e.push(t[n]);
    for (n in e) {
      var s, r = e[n].match(/\{[^\}]+\}/g),
        o = [];
      for (s in r) {
        var h = r[s].substring(1, r[s].length - 1);
        o.push(h)
      }
      for (var c = !1, i = 0; i < a.length; i++) o.join("") == a[i].join("") && (c = !0);
      c || a.push(o)
    }
    for (var l = [], n = a.length - 1; 0 <= n; n--) l.push(a[n]);
    var d = '<li class="tit">搜索记录</li>',
      m = "",
      p = 4;
    (a = l).length < 4 && (p = a.length);
    for (n = 0; n < p; n++) {
      var f, u = "'" + a[n] + "'",
        C = (d += '<li class="con"><a class="a1" href="javascript:Chaoshi.searchHistory(' + u + ');">', m += '<li><a href="javascript:Chaoshi.searchHistory(' + u + ');"><span class="sear-res-l">', a[n]),
        v = "",
        y = "",
        b = "",
        g = "",
        _ = "",
        k = "",
        w = "",
        x = "",
        S = "",
        P = "",
        j = "";
      for (f in C) "breed" == (h = C[f].split("_"))[0] && (v = h[1].replace(/\+/g, ",")), "keyword" == h[0] && (y = h[1].replace(/\+/g, ",")), "spec" == h[0] && (b = h[1].replace(/\+/g, ",")), "material" == h[0] && (g = h[1].replace(/\+/g, ",")), "city" == h[0] && (_ = h[1].replace(/\+/g, ",")), "factory" == h[0] && (k = h[1].replace(/\+/g, ",")), "stock" == h[0] && (w = h[1]), "thickness" == h[0] && (x = "厚度" + h[1]), "width" == h[0] && (S = "宽度" + h[1]), "length" == h[0] && (j = "长度" + h[1]), "price" == h[0] && (P = "价格" + h[1]);
      var q = [];
      v && q.push(v), y && q.push(y), b && q.push(b), g && q.push(g), _ && q.push(_), k && q.push(k), w && q.push(w), x && q.push(x), S && q.push(S), j && q.push(j), P && q.push(P), d = d + q.join("<span>+</span>") + ('</a><a class="a2" href="javascript:Chaoshi.removeHistory(' + u + ');">删除</a></li>'), m = m + q.join("<span>+</span>") + '</span><span class="sear-res-r">搜索历史</span></a></li>'
    }
    $("#history_content").html(d), $(".sear-history").html(m)
  },
  removeHistory: function (e) {
    var a, t, i = Chaoshi.getCookie("csHistorySearch"),
      s = [],
      r = "",
      o = (i = decodeURIComponent(i)).split("/");
    for (a in o)(t = o[a].replace(/\}{/g, ",").replace(/\{/g, "").replace(/\}/g, "")) != e && "" != t && s.push(t);
    for (a in s) 0 < a && (r += "/"), r += t = "{" + s[a].replace(/\,/g, "}{") + "}";
    Chaoshi.setCookie("csHistorySearch", r), Chaoshi.historySearchFun()
  },
  refreshHistory: function (e) {
    var a, t, i = Chaoshi.getCookie("csHistorySearch"),
      s = [],
      r = "",
      o = (i = decodeURIComponent(i)).split("/");
    for (a in o)(t = o[a].replace(/\}{/g, ",").replace(/\{/g, "").replace(/\}/g, "")) != e && "" != t && s.push(t);
    for (a in s.push(e), s) 0 < a && (r += "/"), r += t = "{" + s[a].replace(/\,/g, "}{") + "}";
    Chaoshi.setCookie("csHistorySearch", r), Chaoshi.historySearchFun()
  },
  searchHistory: function (e) {
    $(".search-filter-more").hide(), $("#search_filter").html("");
    var a = e.split(",");
    Chaoshi.searchParam = {
      breedNames: "",
      breedIds: "",
      prBreedId: "",
      specs: "",
      materials: "",
      brands: "",
      warehouses: "",
      cityId: Chaoshi.cityId,
      cityName: "",
      startThickness: "",
      endThickness: "",
      startWidth: "",
      endWidth: "",
      startLength: "",
      endLength: "",
      startPrice: "",
      endPrice: "",
      pageSize: "28",
      pageNum: "1",
      breedSort: "",
      specSort: "",
      materialSort: "",
      brandSort: "",
      citySort: "",
      warehouseSort: "",
      averageQtySort: "",
      priceSort: "",
      keyword: ""
    };
    for (var t = 0; t < a.length; t++) {
      var i, s, r, o, h, c, l = a[t].split("_"),
        n = l[0];
      l = 0 < l[1].indexOf("+") ? l[1].replace(/\+/g, ",") : l[1], "breed" == n ? Chaoshi.searchParam.breedNames = l : "keyword" == n ? Chaoshi.searchParam.keyword = l : "breedId" == n ? Chaoshi.searchParam.breedIds = l : "spec" == n ? Chaoshi.searchParam.specs = l : "material" == n ? Chaoshi.searchParam.materials = l : "city" == n ? Chaoshi.searchParam.cityName = l : "cityId" == n ? Chaoshi.searchParam.cityId = l : "factory" == n ? Chaoshi.searchParam.brands = l : "stock" == n ? Chaoshi.searchParam.warehouses = l : "thickness" == n ? (i = r = "", i = 0 < l.indexOf("-") ? (r = (s = l.split("-"))[0], s[1]) : r = l, Chaoshi.searchParam.startThickness = r, Chaoshi.searchParam.endThickness = i) : "price" == n ? (r = s = "", 0 < l.indexOf("大于等于") && (s = l.replace(/[^0-9]+/g, ""), r = ""), 0 < l.indexOf("小于等于") && (r = l.replace(/[^0-9]+/g, s = "")), 0 < l.indexOf("-") && (s = (i = l.split("-"))[0], r = i[1]), Chaoshi.searchParam.startPrice = s, Chaoshi.searchParam.endPrice = r) : "width" == n ? (c = h = "", c = 0 < l.indexOf("-") ? (h = (o = l.split("-"))[0], o[1]) : h = l, Chaoshi.searchParam.startWidth = h, Chaoshi.searchParam.endWidth = c) : "length" == n && (c = h = "", c = 0 < l.indexOf("-") ? (h = (o = l.split("-"))[0], o[1]) : h = l, Chaoshi.searchParam.startLength = h, Chaoshi.searchParam.endLength = c)
    }
    Chaoshi.searchParamsSet(Chaoshi.searchParam.keyword, Chaoshi.searchParam.breedNames, Chaoshi.searchParam.breedIds, Chaoshi.searchParam.specs, Chaoshi.searchParam.materials, Chaoshi.searchParam.cityName, Chaoshi.searchParam.cityId, Chaoshi.searchParam.brands, Chaoshi.searchParam.warehouses, Chaoshi.searchParam.startThickness, Chaoshi.searchParam.endThickness, Chaoshi.searchParam.startPrice, Chaoshi.searchParam.endPrice, Chaoshi.searchParam.startWidth, Chaoshi.searchParam.endWidth, Chaoshi.searchParam.startLength, Chaoshi.searchParam.endLength), Chaoshi.searchList(), Chaoshi.refreshHistory(e)
  },
  searchParamsSet: function (e, a, t, i, s, r, o, h, c, l, n, d, m, p, f, u, C) {
    if ($(".search-inp input").val(""), $(".screen-slide .listitem").find("a").removeClass("cur"), $(".screen-slide .option-all").addClass("cur"), $("#show-logo-div div").removeClass("selected"), e && ((v = []).push({
        id: e,
        text: e
      }), Chaoshi.filterAdd("filter_keyword", v, !0)), a) {
      $("#breed_content .listitem").find("a").removeClass("cur");
      var v = [];
      if (0 < a.indexOf(","))
        for (var y = a.split(","), b = t.split(","), g = 0; g < y.length; g++) {
          var _ = b[g],
            k = y[g];
          v.push({
            id: _,
            text: k
          }), $("#breed" + _).addClass("cur"), $("#breed_more_" + _).prop("checked", !0)
        } else v.push({
          id: t,
          text: a
        }), $("#breed" + t).addClass("cur"), $("#breed_more_" + t).prop("checked", !0), $("#breed").val(a);
      Chaoshi.filterAdd("filter_breed", v, !0), $("#breed_content .option-all").removeClass("cur")
    }
    if (i) {
      $("#spec_content .listitem").find("a").removeClass("cur");
      var v = [];
      if (0 < i.indexOf(","))
        for (y = i.split(","), g = 0; g < y.length; g++) {
          var k = y[g],
            w = (v.push({
              id: k,
              text: k
            }), k.replace(/[\*\.]/g, "_"));
          $("#spec_" + w).addClass("cur"), $("#spec_more_" + w).prop("checked", !0)
        } else {
          v.push({
            id: i,
            text: i
          });
          w = i.replace(/[\*\.]/g, "_");
          $("#spec_" + w).addClass("cur"), $("#spec_more_" + w).prop("checked", !0), $("#spec").val(i)
        }
      Chaoshi.filterAdd("filter_spec", v, !0), $("#spec_content .option-all").removeClass("cur")
    }
    if (s) {
      $("#material_content .listitem").find("a").removeClass("cur");
      var v = [];
      if (0 < s.indexOf(","))
        for (y = s.split(","), g = 0; g < y.length; g++) {
          k = y[g], w = (v.push({
            id: k,
            text: k
          }), k.replace(/[\/()#+\.]/g, "_"));
          $("#material" + w).addClass("cur"), $("#material_more_" + w).prop("checked", !0)
        } else {
          v.push({
            id: s,
            text: s
          });
          w = s.replace(/[\/()#+\.]/g, "_");
          $("#material" + w).addClass("cur"), $("#material_more_" + w).prop("checked", !0), $("#material").val(s)
        }
      Chaoshi.filterAdd("filter_material", v, !0), $("#material_content .option-all").removeClass("cur")
    }
    if (r) {
      $("#city_content .listitem").find("a").removeClass("cur");
      var v = [];
      if (0 < r.indexOf(","))
        for (y = r.split(","), b = o.split(","), g = 0; g < y.length; g++) {
          _ = b[g], k = y[g];
          v.push({
            id: _,
            text: k
          }), $("#city_" + _).addClass("cur"), $("#city_more_" + _).prop("checked", !0)
        } else v.push({
          id: o,
          text: r
        }), $("#city_" + o).addClass("cur"), $("#city_more_" + o).prop("checked", !0), $("#city").text(r), $("#city").attr("data-id", o);
      Chaoshi.filterAdd("filter_city", v, !0), $("#city_content .option-all").removeClass("cur")
    }
    if (h) {
      $("#factory_content #show-logo-div").find("div").removeClass("selected");
      var v = [];
      if (0 < h.indexOf(","))
        for (y = h.split(","), g = 0; g < y.length; g++) {
          k = y[g];
          v.push({
            id: k,
            text: k
          }), $("#factory" + k).addClass("selected")
        } else v.push({
          id: h,
          text: h
        }), $("#factory" + h).addClass("selected"), $("#factory").val(h);
      Chaoshi.filterAdd("filter_factory", v, !0), $("#factory_content .option-all").removeClass("cur")
    }
    c && ((v = []).push({
      id: c,
      text: c
    }), $("#stock").val(c), Chaoshi.filterAdd("filter_stock", v, !0)), l == n && l && n ? Chaoshi.filterAdd("filter_thickness", v = [{
      id: "",
      text: l
    }], !0) : "" == l ? "" != n && Chaoshi.filterAdd("filter_thickness", v = [{
      id: "",
      text: n
    }], !0) : "" == n ? Chaoshi.filterAdd("filter_thickness", v = [{
      id: "",
      text: l
    }], !0) : Chaoshi.filterAdd("filter_thickness", v = [{
      id: "",
      text: l + "-" + n
    }], !0), $(".input-thickness .inp2").val(l), $(".input-thickness .inp3").val(n), "" == d ? "" == m ? ($("#pr1").val("￥最低价"), $("#pr2").val("￥最高价")) : (Chaoshi.filterAdd("filter_price", v = [{
      id: "",
      text: "小于等于" + m
    }], !0), $("#pr1").val("￥最低价"), $("#pr2").val(m)) : "" == m ? (Chaoshi.filterAdd("filter_price", v = [{
      id: "",
      text: "大于等于" + d
    }], !0), $("#pr1").val(d), $("#pr2").val("￥最高价")) : (Chaoshi.filterAdd("filter_price", v = [{
      id: "",
      text: d + "-" + m
    }], !0), $("#pr1").val(d), $("#pr2").val(m)), p == f && p && f ? Chaoshi.filterAdd("filter_width", v = [{
      id: "",
      text: p
    }], !0) : "" == p ? "" != f && Chaoshi.filterAdd("filter_width", v = [{
      id: "",
      text: f
    }], !0) : "" == f ? Chaoshi.filterAdd("filter_width", v = [{
      id: "",
      text: p
    }], !0) : Chaoshi.filterAdd("filter_width", v = [{
      id: "",
      text: p + "-" + f
    }], !0), $(".input-width .inp2").val(p), $(".input-width .inp3").val(f), u == C && u && C ? Chaoshi.filterAdd("filter_length", v = [{
      id: "",
      text: u
    }], !0) : "" == u ? "" != C && Chaoshi.filterAdd("filter_length", v = [{
      id: "",
      text: C
    }], !0) : "" == C ? Chaoshi.filterAdd("filter_length", v = [{
      id: "",
      text: u
    }], !0) : Chaoshi.filterAdd("filter_length", v = [{
      id: "",
      text: u + "-" + C
    }], !0), $(".input-length .inp2").val(u), $(".input-length .inp3").val(C)
  },
  searchPRbreed: function (e) {
    Chaoshi.cityId ? window.location.href = "//chaoshi.banksteel.com?pi=" + e + "&ct=" + Chaoshi.cityId : window.location.href = "//chaoshi.banksteel.com?pi=" + e
  },
  searchChange: function (e) {
    for (var a = $("#search_filter"), t = "", i = "", s = "", r = "", o = "", h = (0 < a.find("#filter_breed").length && (r = a.find("#filter_breed .filter-name").text().split(",")), 0 < a.find("#filter_material").length && (t = a.find("#filter_material .filter-name").text().split(",")), 0 < a.find("#filter_spec").length && a.find("#filter_spec .filter-name").text().split(","), 0 < a.find("#filter_city").length && (i = a.find("#filter_city .filter-name").text().split(",")), 0 < a.find("#filter_factory").length && (s = a.find("#filter_factory .filter-name").text().split(",")), 0 < a.find("#filter_stock").length && (o = a.find("#filter_stock .filter-name").text().split(",")), JSON.parse(JSON.parse(e).categoryList)), c = JSON.parse(JSON.parse(e).materialList), l = (JSON.parse(JSON.parse(e).specList), JSON.parse(JSON.parse(e).factoryList)), n = JSON.parse(JSON.parse(e).areaList), d = JSON.parse(JSON.parse(e).warehouseList), m = "", p = 0; p < h.length; p++) {
      var f = "'" + h[p].name + "'",
        u = "'" + h[p].code + "'",
        C = -1 != r.indexOf(h[p].name) ? "cur" : "";
      m += '<li><span class="block-choose-more"><input type="checkbox" ' + (-1 != r.indexOf(h[p].name) ? "checked" : "") + ' class="check-choose" data-id="' + h[p].code + '" data-name="' + h[p].name + '" id="breed_more_' + h[p].code + '"><label for="breed_more_' + h[p].code + '">' + h[p].name + '</label></span><a class="' + C + '" id="breed' + h[p].code + '" data-id="' + h[p].code + '" href="javascript:Chaoshi.searchSingleBreed(' + u + "," + f + ');" class="listitem-link ' + C + '">' + h[p].name + "</a></li>"
    }
    $("#breed_html").html(m);
    for (var v = "", p = 0; p < c.length; p++) c[p].name && (f = "'" + c[p].name + "'", u = c[p].name.replace(/[\/()#+\.]/g, "_"), "-1" != $.inArray(c[p].name, t) ? v += '<li><span class="block-choose-more"><input type="checkbox" checked class="check-choose" data-id="' + c[p].code + '" data-name="' + c[p].name + '" name="material_more_' + c[p].code + '" id="material_more_' + u + '"><label for="material_more_' + u + '">' + c[p].name + '</label></span><a id="material' + u + '" href="javascript:Chaoshi.searchSingleMaterial(' + f + "," + f + ');" class="cur listitem-link">' + c[p].name + "</a></li>" : v += '<li><span class="block-choose-more"><input type="checkbox" class="check-choose" data-id="' + c[p].code + '" data-name="' + c[p].name + '" name="material_more_' + c[p].code + '" id="material_more_' + u + '"><label for="material_more_' + u + '">' + c[p].name + '</label></span><a id="material' + u + '" href="javascript:Chaoshi.searchSingleMaterial(' + f + "," + f + ');" class="listitem-link">' + c[p].name + "</a></li>");
    $("#material_html").html(v);
    for (var y = "", p = 0; p < l.length; p++) {
      var b = "",
        f = (-1 != s.indexOf(l[p].name) && (b = "selected"), "'" + l[p].code + "'"),
        g = "'" + l[p].name + "'";
      y += p < 6 ? '<div id="factory' + l[p].name + '" class="' + b + '" data-id="' + l[p].code + '" data-name="' + l[p].name + '" onclick="Chaoshi.searchSingleFactory(' + f + "," + g + ')"><span></span>' : '<div id="factory' + l[p].name + '" class="more ' + b + '" data-id="' + l[p].code + '" data-name="' + l[p].name + '" onclick="Chaoshi.searchSingleFactory(' + f + "," + g + ')"><span></span>', l[p].img ? y += '<a href="javascript:;"><img src="//a1.gystatic.com/v6/images/factory/' + l[p].img + '.jpg" width="102" height="36"></a></div>' : y += '<a href="javascript:;">' + l[p].name + "</a></div>"
    }
    y += '<span class="clr"></span>', $("#show-logo-div").html(y);
    for (var _ = "", p = 0; p < n.length; p++) {
      b = "", C = -1 != i.indexOf(n[p].name) ? "cur" : "";
      _ += '<li><span class="block-choose-more"><input type="checkbox" ' + (-1 != i.indexOf(n[p].name) ? "checked" : "") + ' class="check-choose" value="' + n[p].code + "," + n[p].name + '" data-id="' + n[p].code + '" data-name="' + n[p].name + '" name="city_more_' + n[p].code + '" id="city_more_' + n[p].code + '"><label for="city_more_' + n[p].code + '">' + n[p].name + '</label></span><a id="city_' + n[p].code + '" href="javascript:Chaoshi.searchSingleCity(&quot;' + n[p].code + "&quot;,&quot;" + n[p].name + '&quot;)" class="listitem-link ' + C + '">' + n[p].name + "</a></li>"
    }
    $("#changecity").html(_);
    for (var k = "", p = 0; p < d.length; p++) {
      b = "", C = -1 != o.indexOf(d[p].name) ? "cur" : "";
      k += '<li><span class="block-choose-more"><input type="checkbox" ' + (-1 != o.indexOf(d[p].name) ? "checked" : "") + ' class="check-choose" data-id="' + d[p].name + '" data-name="' + d[p].name + '" name="warehouses_more_' + d[p].name + '" id="warehouses_more_' + d[p].name + '"><label for="warehouses_more_' + d[p].name + '">' + d[p].name + '</label></span><a id="warehouses' + d[p].name + '" href="javascript:Chaoshi.searchSingleWarehouses(&quot;' + d[p].name + '&quot;);" class="listitem-link ' + C + '">' + d[p].name + "</a></li>"
    }
    $("#warehouses_html").html(k)
  },
  historySet: function (e, a) {
    var t = "";
    if (Chaoshi.getCookie("csHistorySearch") && (t = Chaoshi.getCookie("csHistorySearch")), a) {
      e = "/", $ele = $("#search_filter .filter");
      for (var i = 0; i < $ele.length; i++) {
        var s = $ele.eq(i).attr("id"),
          r = $ele.eq(i).find(".filter-name").text().replace(/\,/g, "+"),
          o = $ele.eq(i).find(".filter-name").attr("data-id").replace(/\,/g, "+");
        "filter_breed" == s && (e += "{breed_" + r + "}{breedId_" + o + "}"), "filter_keyword" == s ? e += "{keyword_" + r + "}" : "filter_spec" == s ? e += "{spec_" + r + "}" : "filter_material" == s ? e += "{material_" + r + "}" : "filter_city" == s ? e += "{city_" + r + "}{cityId_" + o + "}" : "filter_factory" == s ? e += "{factory_" + r + "}" : "filter_stock" == s ? e += "{stock_" + r + "}" : "filter_thickness" == s ? e += "{thickness_" + r + "}" : "filter_width" == s ? e += "{width_" + r + "}" : "filter_price" == s && (e += "{price_" + r + "}")
      }
    }
    Chaoshi.setCookie("csHistorySearch", t += e), Chaoshi.historySearchFun()
  },
  searchSingleMaterial: function (e, a, t) {
    "total" == e ? (Chaoshi.filterClear($("#filter_material"), t), $("#material_content .option-all").addClass("cur"), $("#material_content .check-choose").prop("checked", !1)) : (Chaoshi.filterAdd("filter_material", [{
      id: e,
      text: a
    }]), $("#material_content .option-all").removeClass("cur")), Chaoshi.querySearch(Chaoshi.urlObj.materialUrl, Chaoshi.$material, a, "searchSingleMaterial"), $("#material_content .listitem").find("a").removeClass("cur"), $("#material_content .listitem").find(".check-choose").prop("checked", !1);
    t = a.replace(/[\/()#+\.]/g, "_");
    $("#material" + t).addClass("cur"), $("#material_more_" + t).prop("checked", !0), Chaoshi.searchParam.materials = a, Chaoshi.searchList()
  },
  searchMoreMaterial: function () {
    $("#material_content .listitem").find("a").removeClass("cur");
    for (var e = $("#material_content .check-choose:checked"), a = [], t = "", i = 0; i < e.length; i++) {
      var s = e.eq(i).attr("data-id"),
        s = (a.push({
          id: s,
          text: e.eq(i).attr("data-name")
        }), e.eq(i).attr("data-name")),
        r = s.replace(/[\/()#+\.]/g, "_");
      $("#material" + r).addClass("cur"), t += 1 <= i ? "," + s : s
    }
    Chaoshi.filterAdd("filter_material", a), $("#material_content .option-all").removeClass("cur"), Chaoshi.searchParam.materials = t, Chaoshi.searchList()
  },
  searchSingleSpec: function (e, a, t) {
    "total" == e ? (Chaoshi.filterClear($("#filter_spec"), t), $("#spec_content .option-all").addClass("cur")) : (Chaoshi.filterAdd("filter_spec", [{
      id: e,
      text: a
    }]), $("#spec_content .option-all").removeClass("cur")), Chaoshi.querySearch(Chaoshi.urlObj.specUrl, Chaoshi.$spec, a, "searchSingleSpec"), $("#spec_content .listitem").find("a").removeClass("cur"), $("#spec_content .listitem").find(".check-choose").prop("checked", !1);
    t = a.replace(/[\*\.]/g, "_");
    $("#spec_" + t).addClass("cur"), $("#spec_more_" + t).prop("checked", !0), Chaoshi.searchParam.specs = a, Chaoshi.searchList()
  },
  searchMoreSpec: function () {
    $("#spec_content .listitem").find("a").removeClass("cur");
    for (var e = $("#spec_content .check-choose:checked"), a = [], t = "", i = 0; i < e.length; i++) {
      var s = e.eq(i).attr("data-id"),
        r = e.eq(i).attr("data-name"),
        s = (a.push({
          id: s,
          text: r
        }), r.replace(/[\*\.]/g, "_"));
      $("#spec_" + s).addClass("cur"), t += 1 <= i ? "," + r : r
    }
    Chaoshi.filterAdd("filter_spec", a), $("#spec_content .option-all").removeClass("cur"), Chaoshi.searchParam.specs = t, Chaoshi.searchList()
  },
  searchSingleCity: function (e, a, t) {
    "quanguo" == e || "" == e || "total" == e ? (Chaoshi.filterClear($("#filter_city"), t), $("#city_content .option-all").addClass("cur"), cityId = "", $(".topbar #cityName").text("全国")) : (Chaoshi.filterAdd("filter_city", [{
      id: e,
      text: a
    }]), $("#city_content .option-all").removeClass("cur"), $(".topbar #cityName").text(a)), setTimeout(function () {
      var e = Chaoshi.$stock.val();
      Chaoshi.querySearch(Chaoshi.urlObj.warehouseUrl, Chaoshi.$stock, e, "searchSingleWarehouses")
    }, 200), $("#city").text(a), $("#city").attr("data-id", e), $("#city_content .listitem").find("a").removeClass("cur"), $("#city_content .listitem").find(".check-choose").prop("checked", !1), $("#city_" + e).addClass("cur"), $("#city_more_" + e).prop("checked", !0), Chaoshi.searchParam.cityId = "total" == e ? "" : e, Chaoshi.searchParam.cityName = "全国" != a ? a : "", Chaoshi.searchList()
  },
  searchMoreCity: function () {
    $("#city_content .listitem").find("a").removeClass("cur");
    for (var e = $("#city_content .check-choose:checked"), a = [], t = "", i = "", s = 0; s < e.length; s++) {
      var r = e.eq(s).attr("data-id"),
        o = e.eq(s).attr("data-name");
      a.push({
        id: r,
        text: o
      }), $("#city_" + r).addClass("cur"), 1 <= s ? (t += "," + r, i += "," + o) : (t += r, i += o)
    }
    Chaoshi.filterAdd("filter_city", a), $("#city_content .option-all").removeClass("cur"), Chaoshi.searchParam.cityId = t, Chaoshi.searchParam.cityName = i, Chaoshi.searchList()
  },
  searchSingleFactory: function (e, a, t) {
    $("#factory_content .listitem").hasClass("choose-more") || ("total" == e ? (Chaoshi.filterClear($("#filter_factory"), t), $("#factory_content .option-all").addClass("cur")) : (Chaoshi.filterAdd("filter_factory", [{
      id: e,
      text: a
    }]), $("#factory_content .option-all").removeClass("cur")), Chaoshi.querySearch(Chaoshi.urlObj.factoryUrl, Chaoshi.$factory, a, "searchSingleFactory"), $("#factory_content .show-logo").find("div").removeClass("selected"), $("#factory" + a).addClass("selected"), Chaoshi.searchParam.brands = a, Chaoshi.searchList())
  },
  searchMoreFactory: function () {
    for (var e = $("#factory_content #show-logo-div").find(".selected"), a = [], t = "", i = 0; i < e.length; i++) {
      var s = e.eq(i).attr("data-id"),
        r = e.eq(i).attr("data-name");
      a.push({
        id: s,
        text: r
      }), t += 1 <= i ? "," + r : r
    }
    Chaoshi.filterAdd("filter_factory", a), $("#factory_content .option-all").removeClass("cur"), Chaoshi.searchParam.brands = t, Chaoshi.searchList()
  },
  searchSingleThickness: function (e, a, t) {
    Chaoshi.searchParam.startThickness = e || a, Chaoshi.searchParam.endThickness = a || e, "" == e ? "" == a ? (Chaoshi.filterClear($("#filter_thickness"), t), $(".input-thickness input").val("")) : Chaoshi.filterAdd("filter_thickness", [{
      id: "",
      text: a
    }]) : "" == a ? Chaoshi.filterAdd("filter_thickness", [{
      id: "",
      text: e
    }]) : Chaoshi.filterAdd("filter_thickness", [{
      id: "",
      text: e + "-" + a
    }])
  },
  searchSingleWidth: function (e, a, t) {
    Chaoshi.searchParam.startWidth = e || a, Chaoshi.searchParam.endWidth = a || e, "" == e ? "" == a ? (Chaoshi.filterClear($("#filter_width"), t), $(".input-width input").val("")) : Chaoshi.filterAdd("filter_width", [{
      id: "",
      text: a
    }]) : "" == a ? Chaoshi.filterAdd("filter_width", [{
      id: "",
      text: e
    }]) : Chaoshi.filterAdd("filter_width", [{
      id: "",
      text: e + "-" + a
    }])
  },
  searchSingleLength: function (e, a, t) {
    Chaoshi.searchParam.startLength = e || a, Chaoshi.searchParam.endLength = a || e, "" == e ? "" == a ? (Chaoshi.filterClear($("#filter_length"), t), $(".input-length input").val("")) : Chaoshi.filterAdd("filter_length", [{
      id: "",
      text: a
    }]) : "" == a ? Chaoshi.filterAdd("filter_length", [{
      id: "",
      text: e
    }]) : Chaoshi.filterAdd("filter_length", [{
      id: "",
      text: e + "-" + a
    }])
  },
  searchSinglePrice: function (e, a, t) {
    Chaoshi.searchParam.startPrice = e, Chaoshi.searchParam.endPrice = a, "" == e ? "" == a ? (Chaoshi.filterClear($("#filter_price"), t), $("#pr1").val("￥最低价"), $("#pr2").val("￥最高价")) : Chaoshi.filterAdd("filter_price", [{
      id: "",
      text: "小于等于" + a
    }]) : "" == a ? Chaoshi.filterAdd("filter_price", [{
      id: "",
      text: "大于等于" + e
    }]) : Chaoshi.filterAdd("filter_price", [{
      id: "",
      text: e + "-" + a
    }]), Chaoshi.searchList()
  },
  searchSingleWarehouses: function (e, a, t) {
    "total" == e ? (Chaoshi.filterClear($("#filter_stock"), t), $("#warehouse_content .option-all").addClass("cur"), $("#warehouse_content .check-choose").prop("checked", !1), a = "") : (Chaoshi.filterAdd("filter_stock", [{
      id: e,
      text: a = a || e
    }]), $("#warehouse_content .option-all").removeClass("cur")), Chaoshi.querySearch(Chaoshi.urlObj.warehouseUrl, Chaoshi.$stock, a, "searchSingleWarehouses"), $("#warehouse_content .listitem").find("a").removeClass("cur"), $("#warehouse_content .listitem").find(".check-choose").prop("checked", !1);
    t = a.replace(/[\/()#+\.]/g, "_");
    $("#warehouses" + t).addClass("cur"), $("#warehouses_more_" + t).prop("checked", !0), Chaoshi.searchParam.warehouses = a, Chaoshi.searchList()
  },
  searchMorewarehouses: function () {
    $("#warehouse_content .listitem").find("a").removeClass("cur");
    for (var e = $("#warehouse_content .check-choose:checked"), a = [], t = "", i = 0; i < e.length; i++) {
      var s = e.eq(i).attr("data-id"),
        s = (a.push({
          id: s,
          text: e.eq(i).attr("data-name")
        }), e.eq(i).attr("data-name")),
        r = s.replace(/[\/()#+\.]/g, "_");
      $("#warehouses" + r).addClass("cur"), t += 1 <= i ? "," + s : s
    }
    Chaoshi.filterAdd("filter_stock", a), $("#warehouse_content .option-all").removeClass("cur"), Chaoshi.searchParam.warehouses = t, Chaoshi.searchList()
  },
  filterAdd: function (e, a, t) {
    $(".search-filter-more").show();
    for (var i, s = "", r = "", o = "", h = "", c = "", l = "", n = "", d = "", m = 0; m < a.length; m++) 1 <= m && (o += ",", r += ",", c += "+", h += "+"), o += escapeHTML(a[m].text), r += escapeHTML(a[m].id), c += escapeHTML(a[m].text), h += escapeHTML(a[m].id);
    "filter_breed" == e ? (l = "品种", i = $("#filter_breed"), n = "Chaoshi.searchSingleBreed('total','');", d = "{breed_" + c + "}{breedId_" + h + "}") : "filter_keyword" == e ? (l = "关键字", i = $("#filter_keyword"), n = "Chaoshi.searchKeyword('');", d = "{keyword_" + c + "}") : "filter_spec" == e ? (l = "规格", i = $("#filter_spec"), n = "Chaoshi.searchSingleSpec('total','');", d = "{spec_" + c + "}") : "filter_material" == e ? (l = "材质", i = $("#filter_material"), n = "Chaoshi.searchSingleMaterial('total','');", d = "{material_" + c + "}") : "filter_city" == e ? (l = "交货地", i = $("#filter_city"), n = "Chaoshi.searchSingleCity('total','');", d = "{city_" + c + "}{cityId_" + h + "}") : "filter_factory" == e ? (l = "钢厂", i = $("#filter_factory"), n = "Chaoshi.searchSingleFactory('total','');", d = "{factory_" + c + "}") : "filter_stock" == e ? (l = "仓库", i = $("#filter_stock"), n = "Chaoshi.searchSingleWarehouses('total','');", d = "{stock_" + c + "}") : "filter_thickness" == e ? (l = "厚度", i = $("#filter_thickness"), n = "Chaoshi.searchSingleThickness('','');", d = "{thickness_" + c + "}") : "filter_width" == e ? (l = "宽度", i = $("#filter_width"), n = "Chaoshi.searchSingleWidth('','');", d = "{width_" + c + "}") : "filter_length" == e ? (l = "长度", i = $("#filter_length"), n = "Chaoshi.searchSingleLength('','');", d = "{length_" + c + "}") : "filter_price" == e && (l = "价格", i = $("#filter_price"), n = "Chaoshi.searchSinglePrice('','');", d += "{price_" + c + "}"), 0 < i.length ? (i.html(s = '<div class="fl">' + l + '：</div><div class="fl filter-name" data-id="' + r + '">' + o + '</div><span onclick="' + n + '"></span>'), t || Chaoshi.historySet(d, !0)) : (s = '<div class="filter" id="' + e + '"><div class="fl">' + l + '：</div><div class="fl filter-name" data-id="' + r + '">' + o + '</div><span onclick="' + n + '"></span></div>', $("#search_filter").append(s), t || Chaoshi.historySet(d))
  },
  filterGet: function (e) {
    return $("#search_filter").find("#filter_" + e).find(".filter-name").text()
  },
  warehouseInfor: function (a, e) {
    $.ajax({
      url: Chaoshi.urlObj.warehouseInforUrl,
      type: "post",
      data: {
        code: escape(e)
      },
      success: function (e) {
        e && (e = e, a.siblings(".pop-warehouse").html('<strong class="f14 blue">' + e.name + "</strong><br><strong>仓库地址：</strong>" + e.address + "<br><strong>联系电话：</strong>" + e.phone), a.nextAll().toggle())
      }
    })
  },
  keywordSearch: function (o) {
    var h, c;
    "" != o ? (h = "", c = 0, -1 != escape(o).indexOf("%u") ? $.ajax({
      url: Chaoshi.urlObj.categoryUrl,
      type: "post",
      data: {
        name: o,
        parentCategoryCode: ""
      },
      dataType: "json",
      success: function (e) {
        if (e) {
          for (var a = e.recordList, t = [], i = 0; i < a.length; i++)
            for (var s = 0; s < a.length; s++)
              if (a[i].name == a[s].name) {
                i == s && t.push(a[i]);
                break
              } if (5 <= t.length) {
            for (i = 0; i < 5; i++) {
              t[i].code;
              var r = "'" + t[i].name + "'";
              h += '<li><a href="javascript:Chaoshi.searchKeyword(' + r + ');"><span class="sear-res-l">' + t[i].name + "</span></a></li>"
            }
            $(".sear-res").html(h)
          } else {
            c += t.length;
            for (i = 0; i < t.length; i++) {
              t[i].code;
              r = "'" + t[i].name + "'";
              h += '<li><a href="javascript:Chaoshi.searchKeyword(' + r + ');"><span class="sear-res-l">' + t[i].name + "</span></a></li>"
            }
            $.ajax({
              url: Chaoshi.urlObj.factoryUrl,
              type: "post",
              data: {
                name: o,
                parentCategoryCode: ""
              },
              dataType: "json",
              success: function (e) {
                if (e) {
                  for (var a = e.recordList, t = [], i = 0; i < a.length; i++)
                    for (var s = 0; s < a.length; s++)
                      if (a[i].name == a[s].name) {
                        i == s && t.push(a[i]);
                        break
                      } if (5 <= c + t.length) {
                    for (i = 0; i < 5 - c; i++) {
                      t[i].code;
                      var r = "'" + t[i].name + "'";
                      h += '<li><a href="javascript:Chaoshi.searchKeyword(' + r + ');"><span class="sear-res-l">' + t[i].name + "</span></a></li>"
                    }
                    $(".sear-res").html(h)
                  } else {
                    c += t.length;
                    for (i = 0; i < t.length; i++) {
                      t[i].code;
                      r = "'" + t[i].name + "'";
                      h += '<li><a href="javascript:Chaoshi.searchKeyword(' + r + ');"><span class="sear-res-l">' + t[i].name + "</span></a></li>"
                    }
                    $.ajax({
                      url: Chaoshi.urlObj.warehouseUrl,
                      type: "post",
                      data: {
                        name: o,
                        parentCategoryCode: ""
                      },
                      dataType: "json",
                      success: function (e) {
                        if (e) {
                          for (var a = e.recordList, t = [], i = 0; i < a.length; i++)
                            for (var s = 0; s < a.length; s++)
                              if (a[i].name == a[s].name) {
                                i == s && t.push(a[i]);
                                break
                              } if (5 <= c + t.length) {
                            for (i = 0; i < 5 - c; i++) {
                              t[i].code;
                              var r = "'" + t[i].name + "'";
                              h += '<li><a href="javascript:Chaoshi.searchKeyword(' + r + ');"><span class="sear-res-l">' + t[i].name + "</span></a></li>"
                            }
                            $(".sear-res").html(h)
                          } else {
                            c += t.length;
                            for (i = 0; i < t.length; i++) {
                              t[i].code;
                              r = "'" + t[i].name + "'";
                              h += '<li><a href="javascript:Chaoshi.searchKeyword(' + r + ');"><span class="sear-res-l">' + t[i].name + "</span></a></li>"
                            }
                            "" == h ? $(".sear-res").html("<li>暂无匹配结果</li>") : $(".sear-res").html(h)
                          }
                        }
                      }
                    })
                  }
                }
              }
            })
          }
        }
      }
    }) : $.ajax({
      url: Chaoshi.urlObj.materialUrl,
      type: "post",
      data: {
        name: o,
        parentCategoryCode: ""
      },
      dataType: "json",
      success: function (e) {
        if (e) {
          for (var a = e.recordList, t = [], i = 0; i < a.length; i++)
            for (var s = 0; s < a.length; s++)
              if (a[i].name == a[s].name) {
                i == s && t.push(a[i]);
                break
              } if (5 <= t.length) {
            for (i = 0; i < 5; i++) {
              t[i].code;
              var r = "'" + t[i].name + "'";
              h += '<li><a href="javascript:Chaoshi.searchKeyword(' + r + ');"><span class="sear-res-l">' + t[i].name + "</span></a></li>"
            }
            $(".sear-res").html(h)
          } else {
            c += t.length;
            for (i = 0; i < t.length; i++) {
              t[i].code;
              r = "'" + t[i].name + "'";
              h += '<li><a href="javascript:Chaoshi.searchKeyword(' + r + ');"><span class="sear-res-l">' + t[i].name + "</span></a></li>"
            }
            $.ajax({
              url: Chaoshi.urlObj.specUrl,
              type: "post",
              data: {
                name: o,
                parentCategoryCode: ""
              },
              dataType: "json",
              success: function (e) {
                if (e) {
                  for (var a = e.recordList, t = [], i = 0; i < a.length; i++)
                    for (var s = 0; s < a.length; s++)
                      if (a[i].name == a[s].name) {
                        i == s && t.push(a[i]);
                        break
                      } if (5 <= c + t.length) {
                    for (i = 0; i < 5 - c; i++) {
                      t[i].code;
                      var r = "'" + t[i].name + "'";
                      h += '<li><a href="javascript:Chaoshi.searchKeyword(' + r + ');"><span class="sear-res-l">' + t[i].name + "</span></a></li>"
                    }
                    $(".sear-res").html(h)
                  } else {
                    c += t.length;
                    for (i = 0; i < t.length; i++) {
                      t[i].code;
                      r = "'" + t[i].name + "'";
                      h += '<li><a href="javascript:Chaoshi.searchKeyword(' + r + ');"><span class="sear-res-l">' + t[i].name + "</span></a></li>"
                    }
                    "" == h ? $(".sear-res").html("<li>暂无匹配结果</li>") : $(".sear-res").html(h)
                  }
                }
              }
            })
          }
        }
      }
    })) : $(".sear-res").html(Chaoshi.keyRes)
  },
  querySearch: function (e, h, a, c) {
    var t = {};
    e == Chaoshi.urlObj.categoryUrl ? t = {
      name: a,
      parentCategoryCode: $(".tab-slider li.cur").attr("data-id")
    } : e == Chaoshi.urlObj.materialUrl ? t = {
      name: a,
      categoryCode: $("#category").attr("data-id")
    } : e == Chaoshi.urlObj.specUrl ? t = {
      name: a,
      categoryCode: $("#category").attr("data-id"),
      token: Chaoshi.getCookie("user_token")
    } : e == Chaoshi.urlObj.factoryUrl ? t = {
      name: a
    } : e == Chaoshi.urlObj.warehouseUrl && (t = {
      name: a,
      areaCode: a = "quanguo" != (a = $("#city").attr("data-id")) && "total" != a ? a : ""
    }), $.ajax({
      url: e,
      type: "post",
      data: t,
      dataType: "json",
      success: function (e) {
        if (e) {
          var a = "",
            t = e.recordList;
          if (c) {
            for (var i = 0; i < t.length; i++)
              for (var s, r = 0; r < t.length; r++)
                if (t[i].name == t[r].name) {
                  i == r && (o = t[i].code ? "'" + t[i].code + "'" : "'" + t[i].name + "'", s = "'" + t[i].name + "'", a += '<a data-prams="' + o + '" href="javascript:Chaoshi.' + c + "(" + o + "," + s + ');">' + t[i].name + "</a>");
                  break
                }
          } else
            for (i = 0; i < t.length; i++)
              for (var o, r = 0; r < t.length; r++)
                if (t[i].name == t[r].name) {
                  i == r && (a += '<a data-prams="' + (o = t[i].code ? "'" + t[i].code + "'" : "'" + t[i].name + "'") + '">' + t[i].name + "</a>");
                  break
                } h.siblings(".search-box-down").html(a)
        }
      }
    })
  },
  searchKeyword: function (e) {
    "" == e ? (Chaoshi.filterClear($("#filter_keyword"), !0), $(".sear-res").html(Chaoshi.keyRes)) : Chaoshi.filterAdd("filter_keyword", [{
      id: e,
      text: e
    }]), Chaoshi.searchParam.keyword = e, Chaoshi.searchList()
  },
  searchSingleBreed: function (e, a, t) {
    "total" == e ? (Chaoshi.filterClear($("#filter_breed"), t), $("#breed_content .option-all").addClass("cur"), $("#breed_content .check-choose").prop("checked", !1)) : (Chaoshi.filterAdd("filter_breed", [{
      id: e,
      text: a
    }]), $("#breed_content .option-all").removeClass("cur")), Chaoshi.$category.attr("data-id", e), Chaoshi.querySearch(Chaoshi.urlObj.categoryUrl, Chaoshi.$category, a, "searchSingleBreed"), setTimeout(function () {
      var e = Chaoshi.$spec.val(),
        a = Chaoshi.$material.val();
      Chaoshi.querySearch(Chaoshi.urlObj.specUrl, Chaoshi.$spec, e, "searchSingleSpec"), Chaoshi.querySearch(Chaoshi.urlObj.materialUrl, Chaoshi.$material, a, "searchSingleMaterial")
    }, 200), $("#breed_content .listitem").find("a").removeClass("cur"), $("#breed_content .listitem").find(".check-choose").prop("checked", !1), $("#breed" + e).addClass("cur"), $("#breed_more_" + e).prop("checked", !0), "total" == e ? (Chaoshi.searchParam.breedIds = "", Chaoshi.searchParam.breedNames = "") : (Chaoshi.searchParam.breedIds = e, Chaoshi.searchParam.breedNames = a), Chaoshi.searchList()
  },
  searchMoreBreed: function () {
    $("#breed_content .listitem").find("a").removeClass("cur");
    for (var e = $("#breed_content .check-choose:checked"), a = [], t = "", i = 0; i < e.length; i++) {
      var s = e.eq(i).attr("data-id"),
        r = e.eq(i).attr("data-name");
      a.push({
        id: s,
        text: r
      }), $("#breed" + s).addClass("cur"), t += 1 <= i ? "," + s : s
    }
    Chaoshi.filterAdd("filter_breed", a), $("#breed_content .option-all").removeClass("cur"), Chaoshi.searchParam.breedIds = t, Chaoshi.searchList()
  },
  tabSlider: function () {
    var i = $(".tab-subject-line .line"),
      e = $(".tab-slider .cur").outerWidth(!0),
      a = $(".tab-slider .cur").offset().left - $(".tab-slider").offset().left,
      t = 60 + a;
    i.stop().animate({
      left: a,
      width: e
    }, 300), $(".tab-subject-line i").stop().animate({
      left: t
    }, 300), $(".tab-slider a").hover(function () {
      var e = $(this).outerWidth(!0),
        a = $(this).offset().left - $(".tab-slider").offset().left,
        t = 60 + a;
      i.stop().animate({
        left: a,
        width: e
      }, 300), $(".tab-subject-line i").stop().animate({
        left: t
      }, 300)
    }, function () {
      i.stop().animate({
        left: a,
        width: e
      }, 300), $(".tab-subject-line i").stop().animate({
        left: t
      }, 300)
    })
  },
  PageClick: function (e) {
    Chaoshi.searchList(e, !0), $("#page_num").text(e)
  },
  init: function () {
    var a = {
      shanghai: 310100,
      nanjing: 320100,
      wuxi: 320200,
      wuhan: 420100,
      changsha: 430100,
      hefei: 340100,
      nanchang: 360100,
      yangzhou: 321e3,
      zhangjiagang: 320582,
      lianyungang: 320700,
      xuzhou: 320300,
      hangzhou: 330100,
      ningbo: 330200,
      fuzhou: 350100,
      xiamen: 350200,
      guangzhou: 440100,
      lecong: 440609,
      chengdu: 510100,
      chongqing: 500100,
      jinan: 370100,
      qingdao: 370200,
      handan: 130400,
      zhengzhou: 410100,
      tangshan: 130200,
      tianjin: 120100,
      beijing: 110100,
      shenyang: 210100,
      xian: 610100,
      taiyuan: 140100,
      kunming: 530100
    };
    a[Chaoshi.cityId] ? [{
      cityId: "310100",
      cityName: "上海"
    }, {
      cityId: "320100",
      cityName: "南京"
    }, {
      cityId: "320582",
      cityName: "张家港"
    }, {
      cityId: "320200",
      cityName: "无锡"
    }, {
      cityId: "320282",
      cityName: "宜兴"
    }, {
      cityId: "321000",
      cityName: "扬州"
    }, {
      cityId: "320300",
      cityName: "徐州"
    }, {
      cityId: "320700",
      cityName: "连云港"
    }, {
      cityId: "330100",
      cityName: "杭州"
    }, {
      cityId: "330200",
      cityName: "宁波"
    }, {
      cityId: "330300",
      cityName: "温州"
    }, {
      cityId: "330400",
      cityName: "嘉兴"
    }, {
      cityId: "330700",
      cityName: "金华"
    }, {
      cityId: "430100",
      cityName: "长沙"
    }, {
      cityId: "440100",
      cityName: "广州"
    }, {
      cityId: "440600",
      cityName: "佛山"
    }, {
      cityId: "440609",
      cityName: "乐从"
    }, {
      cityId: "610100",
      cityName: "西安"
    }, {
      cityId: "120100",
      cityName: "天津"
    }, {
      cityId: "130200",
      cityName: "唐山"
    }, {
      cityId: "130400",
      cityName: "邯郸"
    }, {
      cityId: "370200",
      cityName: "青岛"
    }, {
      cityId: "410100",
      cityName: "郑州"
    }, {
      cityId: "140100",
      cityName: "太原"
    }, {
      cityId: "420100",
      cityName: "武汉"
    }, {
      cityId: "340100",
      cityName: "合肥"
    }, {
      cityId: "360100",
      cityName: "南昌"
    }, {
      cityId: "510100",
      cityName: "成都"
    }, {
      cityId: "500100",
      cityName: "重庆"
    }, {
      cityId: "110100",
      cityName: "北京"
    }, {
      cityId: "530100",
      cityName: "昆明"
    }, {
      cityId: "",
      cityName: "全国"
    }].map(function (e) {
      a[Chaoshi.cityId] == e.cityId && $(".topbar #cityName").text(e.cityName)
    }) : $(".topbar #cityName").text("全国"), $(".valuebox-input input").keyup(function (e) {
      13 == e.keyCode && Chaoshi.searchAll()
    }), $("#spec_content .inp2").on("blur", function () {
      $(this).parent().find(".inp3").attr("placeholder", $(this).val())
    }), $("#spec_content .inp3").on("focus", function () {
      $(this).attr("placeholder", "")
    }), $(".search-box-recommend .price-box .inputs").on("focus", function () {
      $(".search-box-recommend .price-box").addClass("price-box-hover"), $(".search-box-recommend .price-box").removeClass("price-box"), $(document).on("click", function e() {
        $(".search-box-recommend .price-box-hover").addClass("price-box"), $(".search-box-recommend .price-box-hover").removeClass("price-box-hover"), $(document).off("click", e)
      })
    }).on("click", function (e) {
      e.stopPropagation()
    }), $("#price-box-btn").click(function (e) {
      e.stopPropagation(), $(".search-box-recommend .price-box-hover").addClass("price-box"), $(".search-box-recommend .price-box-hover").removeClass("price-box-hover")
    }), $.tab(".pop-cangku .title li", ".col", "cur", "click", "0"), $("#col-city li a").click(function () {
      $("#col-city").css("display", "none"), $(".pop-cangku .title li").toggleClass("cur")
    }), $(document).on("click", ".item-data .item-data-m", function () {
      $(this).parent(".item-data").hasClass("show") ? ($(this).find(".table_hover div").css("display", "none"), $(this).parent(".item-data").removeClass("show"), $(this).find(".table_hover .table_hover_bottom").css("top", "11px"), $(this).find(".table_hover .table_hover_left").css("height", "44px"), $(this).find(".table_hover .table_hover_right").css("height", "44px"), $(this).parent(".item-data").find(".item-data-detail").remove(), $(this).find(".btn-open").addClass("btnoff"), $(this).find(".btn-open").text("展开")) : Chaoshi.itemSunmary($(this), $(this).attr("data-id"))
    }).find(".count,.price .chat,.warehouse-name,.pop-warehouse,.operate .buy").click(function (e) {
      e.stopPropagation()
    }), $(document).on("click", ".btn-blue-back140", function () {
      $(this).parents(".item-data").find(".item-data-m .table_hover div").css("display", "none"), $(this).parents(".item-data").removeClass("show"), $(this).parents(".item-data").find(".btn-open").addClass("btnoff"), $(this).parent().parent().siblings(".item-data-m").find(".btn-open").text("展开"), $(this).parents(".item-data").find(".item-data-detail").remove()
    }), $(".t-warehouse").click(function (e) {
      Chaoshi.warehouseInfor($(this), $(this).attr("data-code"))
    }), $("#table").on("click", ".t-warehouse", function (e) {
      e.stopPropagation(), Chaoshi.warehouseInfor($(this), $(this).attr("data-code"))
    }), $(".btn-js,.btn-gobuy").click(function () {
      $(this).parents(".pop-problem").css("display", "none")
    }), $(".search-box-recommend .line li .selects").each(function () {
      $(this).on("click", function () {
        $(".search-box-recommend .line li .show-pop").eq($(".search-box-recommend .line li .selects").index($(this))).show(), $(".search-box-recommend .line li .selects").css("border-bottom", "none"), $(".search-box-btn").css("z-index", "99"), $("#col-city").show(), $(document).on("click", function e() {
          $(".search-box-recommend .line li .show-pop").hide(), $(".search-box-recommend .line li .selects").css("border-bottom", "1px solid #d0d0d0"), $(document).off("click", e)
        })
      }).on("click", function (e) {
        e.stopPropagation()
      }), $(".search-box-recommend .line li .show-pop").click(function (e) {
        e.stopPropagation()
      })
    }), $(".search-box-recommend .line").mouseleave(function () {
      $(".search-box-btn").css("z-index", "1")
    }), $(".line li .show-pop").each(function () {
      $(this).mouseenter(function () {
        $(".line li .show-pop").eq($(".line li .show-pop").index($(this))).show(), $(".search-box-recommend .line li .selects").css("border-bottom", "none")
      }), $(this).mouseleave(function () {
        $(".line li .show-pop").eq($(".line li .show-pop").index($(this))).hide(), $(".search-box-recommend .line li .selects").css("border-bottom", "1px solid #D0D0D0")
      })
    }), $(".valuebox-input").click(function () {
      $(this).find(".search-box-down").toggle().css("z-index", "100")
    }), $(".valuebox-input").mouseleave(function () {
      $(this).find(".search-box-down").hide().css("z-index", "10")
    }), $(document).on("mouseenter", ".show-logo div", function () {
      $(this).children("span").addClass("border")
    }), $(document).on("mouseleave", ".show-logo div", function () {
      $(this).children("span").removeClass("border")
    }), $(document).on("click", ".show-logo div", function () {
      $("#factory_content .listitem").hasClass("choose-more") ? $(this).hasClass("selected") ? $(this).removeClass("selected") : $(this).addClass("selected") : ($(this).siblings().removeClass("selected"), $(this).addClass("selected")), $(this).closest(".listitem").siblings(".option-all").removeClass("cur")
    }), $(".btn-option-more").each(function () {
      $(this).click(function () {
        var e = $(".btn-option-more").index($(this));
        $(".listitem").eq(1 < e ? e + 1 : e).toggleClass("showmore"), $(".btn-option-more p").eq(e).toggle()
      })
    }), $(".item-data-detail .pad-l14").mouseenter(function () {
      $(this).children(".pop-bname").show()
    }), $(".item-data-detail .pad-l14").mouseleave(function () {
      $(this).children(".pop-bname").hide()
    }), $(".btn-choosemore").each(function () {
      $(this).click(function () {
        var e = $(".btn-choosemore").index($(this));
        $(".listitem").eq(1 < e ? e + 1 : e).addClass("choose-more showmore"), $(".option-default dl.chosmore").eq(1 < e ? e + 1 : e).addClass("bg"), $(".btn-option-more").eq(e).toggle(), $(".btn-option-more p").eq(e).toggle(), $(".search-valuebox").eq(e).toggle()
      })
    }), $(".btn-reset-choose").each(function () {
      $(this).click(function () {
        var e = $(".btn-reset-choose").index($(this));
        $(".listitem").eq(1 < e ? e + 1 : e).removeClass("choose-more showmore"), $(".option-default dl.chosmore").eq(1 < e ? e + 1 : e).removeClass("bg"), $(".btn-option-more").eq(e).toggle(), $(".btn-option-more p").eq(e).show(), $(".search-valuebox").eq(e).show()
      })
    }), $(".btn-sumbmit-choose").each(function () {
      $(this).click(function () {
        var e = $(".btn-sumbmit-choose").index($(this));
        $(".listitem").eq(1 < e ? e + 1 : e).removeClass("choose-more showmore"), $(".option-default dl.chosmore").eq(1 < e ? e + 1 : e).removeClass("bg"), $(".btn-option-more").eq(e).toggle(), $(".btn-option-more p").eq(e).show(), $(".search-valuebox").eq(e).show()
      })
    }), $(".header-cur-swish").click(function () {
      $(".header-cur-swish .tohide").toggle(), $(".screen-slide").animate({
        height: "toggle"
      }), "true" == Chaoshi.getCookie("csIsShow") ? Chaoshi.setCookie("csIsShow", "false") : Chaoshi.setCookie("csIsShow", "true")
    }), $(".count-null .buy ").click(function () {
      $(".pop-problem").css("display", "block").css("top", "116px"), $(".pop-problem").mouseleave(function () {
        setTimeout(function () {
          $(".pop-problem").fadeOut()
        }, 1e3)
      })
    }), $(document).on("mouseenter", ".chat", function () {
      $(this).children(".pop-tel,.pop-tel-arrow").show()
    }), $(document).on("mouseleave", ".chat", function () {
      $(this).children(".pop-tel,.pop-tel-arrow").hide()
    }), $(document).on("click", ".warehouse-name", function () {
      $(this).children(".pop-warehouse,.pop-warehouse-arrow").show()
    }), $(document).on("mouseleave", ".warehouse-name", function () {
      $(".pop-warehouse,.pop-warehouse-arrow").hide()
    }), $(".mtable").on("mouseenter", "tr", function () {
      $(this).addClass("thover"), $(this).addClass("over")
    }), $(".mtable").on("mouseleave", "tr", function () {
      $(this).removeClass("thover"), $(this).removeClass("over")
    }), $(".mtable tr:even").addClass("alt"), $(".tab-bg-subject li").hover(function () {
      $(this).addClass("hov"), $(".tab-bg-subject li.cur").addClass("clean"), $(this).removeClass("clean")
    }, function () {
      $(this).removeClass("hov"), $(".tab-bg-subject li.cur").removeClass("clean")
    }), Chaoshi.tabSlider(), $(document).on("click", ".screen-slide .listitem ul a", function () {
      $(this).closest("ul").find("a").removeClass("cur"), $(this).closest(".listitem").siblings(".option-all").removeClass("cur"), $(this).addClass("cur")
    }), $(".option-all").click(function () {
      $(this).siblings(".listitem").find("a").removeClass("cur"), 0 < $(this).siblings(".listitem").find(".show-logo").length && $(this).siblings(".listitem").find(".show-logo div").removeClass("selected"), $(this).addClass("cur")
    }), 0 < $("#search_filter .filter").length && $(".search-filter-more").show(), $("#bankSteelpager").bankSteelPager({
      pagenumber: 1,
      pagecount: 200 < Math.ceil(pagcount / 28) ? 200 : Math.ceil(pagcount / 28),
      buttonClickCallback: Chaoshi.PageClick
    }), $(".btn-rightarrow").click(function () {
      var e = parseInt($("#page_num").text()) + 1;
      e <= $("#page_count").text() && ($("#page_num").text(e), Chaoshi.searchList(e, !0))
    }), $(".btn-leftarrow").click(function () {
      var e = parseInt($("#page_num").text()) - 1;
      1 <= e && ($("#page_num").text(e), Chaoshi.searchList(e, !0))
    }), $("#resSeachButton").click(function () {
      var e;
      $("#keyword").is(":visible") && (e = $("#keyword").val(), Chaoshi.searchKeyword(e))
    }), $(document).on("click", ".goods_tips_btn", function () {
      getCookie("user_token") || (window.location.href = "//login.banksteel.com/login.htm?mybackurl=" + window.location.href);
      var e = "全部" == $(".tab-slider .cur").attr("data-name") ? "" : $(".tab-slider .cur").attr("data-name"),
        a = "total" == $(".tab-slider .cur").attr("data-id") ? "" : $(".tab-slider .cur").attr("data-id");
      return goodsBtn = dialog({
        id: "goods_tips_btn",
        title: "钢银找货",
        url: "//res.banksteel.com/dialog/order_dialog.html?firstCatetoryName=" + encodeURIComponent(e) + "&firstCatetoryCode=" + a + "&categoryName=" + encodeURIComponent($("#filter_breed .filter-name").text()) + "&specName=" + encodeURIComponent($("#filter_spec .filter-name").text()) + "&materialName=" + encodeURIComponent($("#filter_material .filter-name").text()) + "&factoryName=" + encodeURIComponent($("#filter_factory .filter-name").text()) + "&areaName=" + encodeURIComponent($("#filter_city .filter-name").text()) + "&warehouseName=" + encodeURIComponent($("#filter_stock .filter-name").text()),
        width: "330",
        height: "305",
        fixed: !0
      }), Autofixed("#goods_tips_btn", goodsBtn), goodsBtn.showModal(), !1
    }), Chaoshi.getCookie("csHistorySearch") ? (Chaoshi.setCookie("csHistorySearch", Chaoshi.getCookie("csHistorySearch") + "/"), Chaoshi.historySearchFun()) : $("#history_content").html('<li class="tit">搜索记录</li>'), $(".search-result").on("click", "a", function () {
      var e = $(this).children(".sear-res-l").text();
      Chaoshi.$keyword.val(e), Chaoshi.keywordSearch(e)
    }), Chaoshi.$keyword.keyup(function () {
      var e = Chaoshi.$keyword.val();
      Chaoshi.keywordSearch(e)
    }), Chaoshi.$category.keyup(function () {
      var e = Chaoshi.$category.val();
      Chaoshi.querySearch(Chaoshi.urlObj.categoryUrl, Chaoshi.$category, e, "searchSingleBreed")
    }), Chaoshi.$spec.keyup(function () {
      var e = Chaoshi.$spec.val();
      Chaoshi.querySearch(Chaoshi.urlObj.specUrl, Chaoshi.$spec, e, "searchSingleSpec")
    }), Chaoshi.$material.keyup(function () {
      var e = Chaoshi.$material.val();
      Chaoshi.querySearch(Chaoshi.urlObj.materialUrl, Chaoshi.$material, e, "searchSingleMaterial")
    }), Chaoshi.$factory.keyup(function () {
      var e = Chaoshi.$factory.val();
      Chaoshi.querySearch(Chaoshi.urlObj.factoryUrl, Chaoshi.$factory, e, "searchSingleFactory")
    }), Chaoshi.$stock.keyup(function () {
      var e = Chaoshi.$stock.val();
      Chaoshi.querySearch(Chaoshi.urlObj.warehouseUrl, Chaoshi.$stock, e, "searchSingleWarehouses")
    }), $(".search-combobox-input input").click(function (e) {
      e.stopPropagation(), $(".search-result").show()
    }), $(document).on("click", ".search-box-down a", function () {
      $(this).parent().siblings("input").val($(this).text())
    }), $(document).click(function () {
      $(".search-result").hide()
    })
  }
};
$(function () {
  Chaoshi.init(), $(".chaoshi-ads").on("click", "a", function () {
    sensors.track("adChaoshiTopClick", {
      advert_url: $(this).attr("href"),
      advert_order: $(this).index() + 1
    }, function () {})
  }), $(".bottom-ads").on("click", "a", function () {
    sensors.track("adChaoshiBottomClick", {
      advert_url: $(this).attr("href"),
      advert_order: $(this).index() + 1
    }, function () {})
  })
});
